/**************************************************************************
 *
 * Copyright (c) 2015-2017  QIKU Company             　　　　　　　            
 *                 奇酷软件（深圳）有限公司  版权所有 2015-2017
 *
 * PROPRIETARY RIGHTS of QIKU Company are involved in the  　　　　　　     
 * subject matter of this material.  All manufacturing, reproduction, use, 
 * and sales rights pertaining to this subject matter are governed by the  
 * license agreement.  The recipient of this software implicitly accepts   
 * the terms of the license.                                               
 * 本软件文档资料是奇酷公司的资产,任何人士阅读和使用本资料必须获得                     
 * 相应的书面授权,承担保密责任和接受相应的法律约束.                                 
 *
 **************************************************************************/
package com.yw.android.common.filelogger;

import android.util.Log;

/**
 * Android系统的日志
 *
 * @author yuanwei
 */
public class AndroidLogAppender implements Appender {
    @Override
    public void close() {
    }

    @Override
    public void writeLogMessage(String tag, String level, String msg) {
        if (level.equals("ERROR")) {
            Log.e(tag, msg);
        } else if (level.equals("INFO")) {
            Log.i(tag, msg);
        } else if (level.equals("DEBUG")) {
            Log.d(tag, msg);
        } else if (level.equals("WARN")) {
            Log.w(tag, msg);
        } else {
            Log.v(tag, msg);
        }
    }

    @Override
    public void setLogLevel(int i) {
    }

    @Override
    public void writeLogMessage(String tag, String level,
                                String msg, Throwable t) {
        if (level.equals("ERROR")) {
            Log.e(tag, msg, t);
        } else if (level.equals("INFO")) {
            Log.i(tag, msg, t);
        } else if (level.equals("DEBUG")) {
            Log.d(tag, msg, t);
        } else if (level.equals("WARN")) {
            Log.w(tag, msg, t);
        } else {
            Log.v(tag, msg, t);
        }
    }
}
